<?php
/**
 * 文章分类模型
 * User 1874
 */


namespace app\adminplatform\model;

use think\facade\Request;
use think\Model;

class ArticleClassify extends Model {
    /*
     * 获取全部文章分类分页
     * @param array $map 条件
     */
    public static function getClassifyList(array $map=[]){

        return ArticleClassify::where($map)->order('ac_id DESC')->paginate(["list_rows"=>PageNum,'query'=>Request::param()]);
    }
    /*
     * 获取全部文章分类列表
     * @param array $map 条件
     * @param int $type 查询方法
     */
    public static function getClassifyListAll(array $map=[], int $type=0) {
        if($type == 0){
            return ArticleClassify::where($map)->select();
        }else{
            return ArticleClassify::where($map)->count("ac_id");
        }
    }
    /*
     * 查询单个文章分类
     * @param array $map 条件
     */
    public static function getClassifyInfo(array $map=[]){

        return ArticleClassify::where($map)->find();
    }
}